package UDP2;

import java.io.IOException;
import java.net.*;

public class Send2 {
    public static void main(String[] args) throws IOException {
        DatagramSocket ds=new DatagramSocket();
        int i=1;
        while (true) {
            byte[] bytes=("这是二号客服端第"+i+"条消息").getBytes();
            DatagramPacket dp=new DatagramPacket(bytes,bytes.length,
                    InetAddress.getLocalHost(),8080);
            ds.send(dp);
            try {
                Thread.sleep(5000);
            } catch (Exception e) {
                System.out.println("线程休眠异常");
                e.printStackTrace();
                break;
            }
        }
    }
}
